import {BaseModel} from "../BaseModel";

export class RecUserResource extends BaseModel{

    constructor(){
        super();
        this.symbolName = "RecUserResource";
        this.tableName = "t_rec_user_resource";
        this.id = '';//主键id
        this.userId = '';//用户id
        this.publisherId = '';//教材id
        this.bookId = '';//书籍id
        this.chapterId = '';//章节id
        this.lessonId = '';//课程id
        this.metaInfoId = '';//资源详情id
        this.metaType = '';//资源类型
        this.description = '';//描述
        this.gmtCreate = '';//创建时间
        this.playTime = '' ; //资源播放时长
    }

    dbMapper(){
        return {
            id : 'id',//主键id
            userId : 'user_id',//名称
            publisherId : 'publisher_id',
            bookId : 'book_id',
            chapterId : 'chapter_id',
            lessonId : 'lesson_id',
            metaInfoId : 'meta_info_id',
            metaType : 'meta_type',
            description : 'description',
            gmtCreate : 'gmt_create',
            playTime:'play_time'
        }
    }

    /**
     * 输出转换
     * @param obj
     * @returns {Book}
     */
    mappingModel(obj){
        let recUserResource = new RecUserResource();
        recUserResource.id = obj.id ? obj.id : ''
        recUserResource.userId = obj.user_id ? obj.user_id : ''
        recUserResource.publisherId = obj.publisher_id ? obj.publisher_id : ''
        recUserResource.bookId = obj.book_id ? obj.book_id : ''
        recUserResource.chapterId = obj.chapter_id ? obj.chapter_id : ''
        recUserResource.lessonId = obj.lesson_id ? obj.lesson_id : ''
        recUserResource.metaInfoId = obj.meta_info_id ? obj.meta_info_id : ''
        recUserResource.metaType = obj.meta_type ? obj.meta_type : ''
        recUserResource.description = obj.description ? obj.description : ''
        recUserResource.gmtCreate = obj.gmt_create ? obj.gmt_create : ''
        recUserResource.playTime = obj.play_time ? obj.play_time : ''

        return recUserResource;
    }

}
